package com.wuhongyu.controller;

import com.wuhongyu.entity.Product;
import com.wuhongyu.service.ProductService;
import com.wuhongyu.util.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 产品...也是只需要查询
 */
@Controller
@RequestMapping("/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @RequestMapping("/list")
    public String list(Model model, HttpServletRequest request, Product product, Integer number) {
        model.addAttribute("url",MyUtil.getUrl(request));
        model.addAttribute("page",productService.findAll(product,number));
        return "~basd/product";
    }

}